Optimal. Leaf size=133 \[ \frac{2 a^3 \tan ^{-1}\left (\frac{a \tan \left (\frac{1}{2} (c+d x)\right )+b}{\sqrt{a^2-b^2}}\right )}{b d \left (a^2-b^2\right )^{3/2}}-\frac{b \tan (c+d x)}{d \left (a^2-b^2\right )}+\frac{a \sec (c+d x)}{d \left (a^2-b^2\right )}-\frac{a^2 x}{b \left (a^2-b^2\right )}+\frac{b x}{a^2-b^2} \]
[Out]
________________________________________________________________________________________
Rubi [A] time = 0.177964, antiderivative size = 133, normalized size of antiderivative = 1., number of steps used = 9, number of rules used = 8, integrand size = 27, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.296, Rules used = {2902, 2606, 8, 3473, 2735, 2660, 618, 204} \[ \frac{2 a^3 \tan ^{-1}\left (\frac{a \tan \left (\frac{1}{2} (c+d x)\right )+b}{\sqrt{a^2-b^2}}\right )}{b d \left (a^2-b^2\right )^{3/2}}-\frac{b \tan (c+d x)}{d \left (a^2-b^2\right )}+\frac{a \sec (c+d x)}{d \left (a^2-b^2\right )}-\frac{a^2 x}{b \left (a^2-b^2\right )}+\frac{b x}{a^2-b^2} \]
Antiderivative was successfully verified.
[In]
[Out]
Rule 2902
Rule 2606
Rule 8
Rule 3473
Rule 2735
Rule 2660
Rule 618
Rule 204
Rubi steps
\begin{align*} \int \frac{\sin (c+d x) \tan ^2(c+d x)}{a+b \sin (c+d x)} \, dx &=\frac{a \int \sec (c+d x) \tan (c+d x) \, dx}{a^2-b^2}-\frac{a^2 \int \frac{\sin (c+d x)}{a+b \sin (c+d x)} \, dx}{a^2-b^2}-\frac{b \int \tan ^2(c+d x) \, dx}{a^2-b^2}\\ &=-\frac{a^2 x}{b \left (a^2-b^2\right )}-\frac{b \tan (c+d x)}{\left (a^2-b^2\right ) d}+\frac{a^3 \int \frac{1}{a+b \sin (c+d x)} \, dx}{b \left (a^2-b^2\right )}+\frac{b \int 1 \, dx}{a^2-b^2}+\frac{a \operatorname{Subst}(\int 1 \, dx,x,\sec (c+d x))}{\left (a^2-b^2\right ) d}\\ &=-\frac{a^2 x}{b \left (a^2-b^2\right )}+\frac{b x}{a^2-b^2}+\frac{a \sec (c+d x)}{\left (a^2-b^2\right ) d}-\frac{b \tan (c+d x)}{\left (a^2-b^2\right ) d}+\frac{\left (2 a^3\right ) \operatorname{Subst}\left (\int \frac{1}{a+2 b x+a x^2} \, dx,x,\tan \left (\frac{1}{2} (c+d x)\right )\right )}{b \left (a^2-b^2\right ) d}\\ &=-\frac{a^2 x}{b \left (a^2-b^2\right )}+\frac{b x}{a^2-b^2}+\frac{a \sec (c+d x)}{\left (a^2-b^2\right ) d}-\frac{b \tan (c+d x)}{\left (a^2-b^2\right ) d}-\frac{\left (4 a^3\right ) \operatorname{Subst}\left (\int \frac{1}{-4 \left (a^2-b^2\right )-x^2} \, dx,x,2 b+2 a \tan \left (\frac{1}{2} (c+d x)\right )\right )}{b \left (a^2-b^2\right ) d}\\ &=-\frac{a^2 x}{b \left (a^2-b^2\right )}+\frac{b x}{a^2-b^2}+\frac{2 a^3 \tan ^{-1}\left (\frac{b+a \tan \left (\frac{1}{2} (c+d x)\right )}{\sqrt{a^2-b^2}}\right )}{b \left (a^2-b^2\right )^{3/2} d}+\frac{a \sec (c+d x)}{\left (a^2-b^2\right ) d}-\frac{b \tan (c+d x)}{\left (a^2-b^2\right ) d}\\ \end{align*}
Mathematica [A] time = 0.769586, size = 152, normalized size = 1.14 \[ \frac{\frac{2 a^3 \tan ^{-1}\left (\frac{a \tan \left (\frac{1}{2} (c+d x)\right )+b}{\sqrt{a^2-b^2}}\right )}{\left (a^2-b^2\right )^{3/2}}+\frac{b (a-b \sin (c+d x))-\left (a^2-b^2\right ) (c+d x) \cos (c+d x)}{(a-b) (a+b) \left (\cos \left (\frac{1}{2} (c+d x)\right )-\sin \left (\frac{1}{2} (c+d x)\right )\right ) \left (\sin \left (\frac{1}{2} (c+d x)\right )+\cos \left (\frac{1}{2} (c+d x)\right )\right )}}{b d} \]
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A] time = 0.093, size = 138, normalized size = 1. \begin{align*} -2\,{\frac{\arctan \left ( \tan \left ( 1/2\,dx+c/2 \right ) \right ) }{bd}}+2\,{\frac{{a}^{3}}{d \left ( a-b \right ) \left ( a+b \right ) b\sqrt{{a}^{2}-{b}^{2}}}\arctan \left ( 1/2\,{\frac{2\,a\tan \left ( 1/2\,dx+c/2 \right ) +2\,b}{\sqrt{{a}^{2}-{b}^{2}}}} \right ) }+16\,{\frac{1}{d \left ( 16\,a-16\,b \right ) \left ( \tan \left ( 1/2\,dx+c/2 \right ) +1 \right ) }}-16\,{\frac{1}{d \left ( 16\,a+16\,b \right ) \left ( \tan \left ( 1/2\,dx+c/2 \right ) -1 \right ) }} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [F(-2)] time = 0., size = 0, normalized size = 0. \begin{align*} \text{Exception raised: ValueError} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [A] time = 1.62385, size = 822, normalized size = 6.18 \begin{align*} \left [\frac{\sqrt{-a^{2} + b^{2}} a^{3} \cos \left (d x + c\right ) \log \left (-\frac{{\left (2 \, a^{2} - b^{2}\right )} \cos \left (d x + c\right )^{2} - 2 \, a b \sin \left (d x + c\right ) - a^{2} - b^{2} - 2 \,{\left (a \cos \left (d x + c\right ) \sin \left (d x + c\right ) + b \cos \left (d x + c\right )\right )} \sqrt{-a^{2} + b^{2}}}{b^{2} \cos \left (d x + c\right )^{2} - 2 \, a b \sin \left (d x + c\right ) - a^{2} - b^{2}}\right ) + 2 \, a^{3} b - 2 \, a b^{3} - 2 \,{\left (a^{4} - 2 \, a^{2} b^{2} + b^{4}\right )} d x \cos \left (d x + c\right ) - 2 \,{\left (a^{2} b^{2} - b^{4}\right )} \sin \left (d x + c\right )}{2 \,{\left (a^{4} b - 2 \, a^{2} b^{3} + b^{5}\right )} d \cos \left (d x + c\right )}, -\frac{\sqrt{a^{2} - b^{2}} a^{3} \arctan \left (-\frac{a \sin \left (d x + c\right ) + b}{\sqrt{a^{2} - b^{2}} \cos \left (d x + c\right )}\right ) \cos \left (d x + c\right ) - a^{3} b + a b^{3} +{\left (a^{4} - 2 \, a^{2} b^{2} + b^{4}\right )} d x \cos \left (d x + c\right ) +{\left (a^{2} b^{2} - b^{4}\right )} \sin \left (d x + c\right )}{{\left (a^{4} b - 2 \, a^{2} b^{3} + b^{5}\right )} d \cos \left (d x + c\right )}\right ] \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [F(-1)] time = 0., size = 0, normalized size = 0. \begin{align*} \text{Timed out} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [A] time = 1.19808, size = 177, normalized size = 1.33 \begin{align*} \frac{\frac{2 \,{\left (\pi \left \lfloor \frac{d x + c}{2 \, \pi } + \frac{1}{2} \right \rfloor \mathrm{sgn}\left (a\right ) + \arctan \left (\frac{a \tan \left (\frac{1}{2} \, d x + \frac{1}{2} \, c\right ) + b}{\sqrt{a^{2} - b^{2}}}\right )\right )} a^{3}}{{\left (a^{2} b - b^{3}\right )} \sqrt{a^{2} - b^{2}}} - \frac{d x + c}{b} + \frac{2 \,{\left (b \tan \left (\frac{1}{2} \, d x + \frac{1}{2} \, c\right ) - a\right )}}{{\left (a^{2} - b^{2}\right )}{\left (\tan \left (\frac{1}{2} \, d x + \frac{1}{2} \, c\right )^{2} - 1\right )}}}{d} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]